<!--
 * @Author: wangming
 * @Date: 2020-09-07 16:57:20
 * @LastEditors: wangming
 * @LastEditTime: 2022-07-20 10:56:39
 * @Description: 应用端form组件内部唯一入口 负责控制显示隐藏
-->
<template>
  <el-col
    :id="config.key"
    :span="config.__config.span"
    class="rel sz"
    v-if="seniorShow && config.key !== null"
    v-show="!config.__config.hide"
  >
    <component
      :config="config"
      :form="form"
      :is="formItemType"
      :descForm="descForm"
    ></component>
  </el-col>
</template>

<script>
import formItem from "./form.vue";
import indexItem from "./indexItem.vue";
export default {
  inject: ["parentLayout"],
  props: {
    descForm: {
      type: Object,
      default: () => {},
    },
    form: {
      type: Object,
      default: () => {},
    },
    config: {
      type: Object,
      default: () => {},
    },
    seniorShow: {
      type: Boolean,
      default: false,
    },
  },
  watch: {
    seniorShow(v) {
      if (!v) {
        this.form[this.config.modelName] = undefined;
      }
    },
  },
  computed: {
    formItemType() {
      return this.parentLayout === "hlLayout" ? "indexItem" : "formItem";
    },
  },
  methods: {},
  components: { formItem, indexItem },
  mounted() {},
};
</script>

<style></style>
